const getMenu = (module: string) => {
  let layout = 'basic'
  // 设置menus
  let menus: any[] = []
  if (module === 'homepage') {
    layout = 'basic'
    menus = [{ path: '/homepage/home', meta: { title: '首页', icon: 'home' }, hidden: false }]
  } else if (module === 'workbench') {
    layout = 'sidebar'
    menus = [
      { path: '/workbench/home', meta: { title: '首页', icon: 'home' }, hidden: false },
      {
        path: '/workbench/more',
        meta: { title: '更多', icon: 'more' },
        hidden: false,
        children: [{ path: '/workbench/test', meta: { title: '测试', icon: 'home' }, hidden: false }]
      }
    ]
  } else if (module === 'bpmn') {
    layout = 'sidebar'
    menus = [{ path: '/bpmn/bpmn-list', meta: { title: '流程管理', icon: 'home' }, hidden: false }]
  } else if (module === 'about') {
    layout = 'basic'
    menus = [{ path: '/about/home', meta: { title: '首页', icon: 'home' }, hidden: false }]
  }
  const res = {
    layout,
    menus
  }
  return new Promise((resolve) => {
    resolve(res)
  })
}

const getMenusMock = () => {
  const menus = [
    {
      name: 'homepage',
      path: 'homepage',
      component: '#',
      meta: { title: '首页', icon: 'home', nav: true },
      children: [
        {
          name: 'homepage-home',
          path: 'home',
          component: '#',
          meta: { title: '首页', icon: 'home' },
          children: []
        }
      ]
    },
    {
      path: 'permission',
      name: 'permission',
      component: '#',
      redirect: null,
      meta: {
        title: '权限管理',
        icon: 'home'
      },
      children: [
        {
          path: 'permission-users',
          name: 'permission-users',
          component: '#',
          redirect: null,
          meta: {
            title: '用户管理',
            icon: 'home'
          },
          children: []
        },
        {
          path: 'permission-roles',
          name: 'permission-roles',
          component: '#',
          redirect: null,
          meta: {
            title: '角色管理',
            icon: 'home'
          },
          children: []
        },
        {
          path: 'permission-menus',
          name: 'permission-menus',
          component: '#',
          redirect: null,
          meta: {
            title: '权限菜单',
            icon: 'home'
          },
          children: []
        },
        {
          path: 'permission-weapp',
          name: 'permission-weapp',
          component: 'permission/permission-weapp',
          redirect: '',
          meta: {
            title: '小程序菜单',
            icon: 'home'
          },
          children: []
        }
      ]
    }
    // { name: '更多', module: 'more', icon: 'more', children: [{ name: '关于', module: 'about', icon: 'about' }] }
  ]
  return menus
}

export { getMenu, getMenusMock }
